home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 1998 November / IRIX 6.5.2 Base Documentation November 1998.img / usr / share / catman / p_man / cat3 / libstiff.z / libstiff
Text File  |  1998-10-30  |  21KB  |  550 lines

  1.  
  2.  
  3.  
  4. LLLLIIIIBBBBSSSSTTTTIIIIFFFFFFFF((((3333))))                      IIIImmmmpppprrrreeeessssssssaaaarrrriiiioooo                       LLLLIIIIBBBBSSSSTTTTIIIIFFFFFFFF((((3333))))
  5.  
  6.  
  7.  
  8. LLLLIIIIBBBBRRRRAAAARRRRYYYY DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  9.      _l_i_b_s_t_i_f_f provides a C Language application programming interface (API)
  10.      for the reading and writing of Stream TIFF files. Stream TIFF (STIFF) is
  11.      a subset of the Tag Image File Format (TIFF) originally developed by
  12.      Aldus Corporation. The TIFF file format is an extremely flexible format
  13.      well suited for monochrome and color bitmap images. The difference
  14.      between TIFF and STIFF is that while a TIFF file may require file seeking
  15.      during reading or writing a STIFF file does not. This means that a STIFF
  16.      file can be read from and written to non-seekable streams such as pipes
  17.      and sockets. It is important to note that a STIFF file may be read by any
  18.      TIFF reader that conforms to the TIFF Revision 6.0 specification.
  19.      However, the _l_i_b_s_t_i_f_f API should not be used to read standard TIFF files.
  20.  
  21.      The functions provided by _l_i_b_s_t_i_f_f greatly simplify the reading and
  22.      writing of TIFF compatible files. Using the STIFF API, TIFF compatible
  23.      files can be read and written without the need to understand the
  24.      structure of a TIFF file and without the need to explicitly specify TIFF
  25.      tags.
  26.  
  27. LLLLIIIIBBBBRRRRAAAARRRRYYYY AAAACCCCCCCCEEEESSSSSSSS
  28.      There are two sets of _l_i_b_s_t_i_f_f functions. One set comprises the generic
  29.      _l_i_b_s_t_i_f_f API. These functions are designated by an SSSSTTTT prefix. These
  30.      functions may be used to read and write generic STIFF files.  To access
  31.      these functions an application must include the header file _s_t_i_f_f._h
  32.      located in the /_u_s_r/_i_n_c_l_u_d_e directory. The second set of _l_i_b_s_t_i_f_f
  33.      functions are a subset of the generic functions and are tailored to
  34.      reading and writing STIFF files that are to be passed between printing
  35.      filters and drivers. These printing related functions are designated by
  36.      the prefix PPPPSSSSTTTT and are accessed through the header file _p_r_i_n_t_s_t_i_f_f._h also
  37.      located in /_u_s_r/_i_n_c_l_u_d_e.  If _p_r_i_n_t_s_t_i_f_f._h is used, the header _s_t_i_f_f._h
  38.      need not be specified.  The generic and printing specific functions may
  39.      be freely intermixed within an application. All _l_i_b_s_t_i_f_f functions
  40.      require that the _s_t_d_i_o._h file be included.
  41.  
  42.      Programs that call _l_i_b_s_t_i_f_f functions must link with the _l_i_b_s_t_i_f_f._a
  43.      library located in the directory /_u_s_r/_l_i_b.
  44.  
  45. FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNNSSSS
  46.    GGGGeeeennnneeeerrrriiiicccc FFFFuuuunnnnccccttttiiiioooonnnnssss
  47.      SSSSttttrrrreeeeaaaammmm HHHHaaaannnnddddlllliiiinnnngggg
  48.                STOpen
  49.                STClose
  50.                STSkipTo
  51.  
  52.      RRRReeeeaaaaddddiiiinnnngggg aaaannnndddd WWWWrrrriiiittttiiiinnnngggg
  53.                STReadImageHeader
  54.                STWriteImageHeader
  55.                STRead
  56.                STWrite
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. LLLLIIIIBBBBSSSSTTTTIIIIFFFFFFFF((((3333))))                      IIIImmmmpppprrrreeeessssssssaaaarrrriiiioooo                       LLLLIIIIBBBBSSSSTTTTIIIIFFFFFFFF((((3333))))
  71.  
  72.  
  73.  
  74.      TTTTIIIIFFFFFFFF TTTTaaaagggg SSSSuuuuppppppppoooorrrrtttt
  75.                STAddTag
  76.                STRemoveTag
  77.                STGetTag
  78.                STPrintTags
  79.  
  80.      EEEExxxxeeeeccccuuuuttttiiiioooonnnn EEEErrrrrrrroooorrrr HHHHaaaannnnddddlllliiiinnnngggg
  81.                STPerror
  82.                STErrorString
  83.  
  84.    PPPPrrrriiiinnnnttttiiiinnnngggg SSSSppppeeeecccciiiiffffiiiicccc FFFFuuuunnnnccccttttiiiioooonnnnssss
  85.      RRRReeeeaaaaddddiiiinnnngggg aaaannnndddd WWWWrrrriiiittttiiiinnnngggg
  86.                PSTReadImageHeader
  87.                PSTWriteImageHeader
  88.  
  89. UUUUSSSSIIIINNNNGGGG TTTTHHHHEEEE LLLLIIIIBBBBSSSSTTTTIIIIFFFFFFFF FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNNSSSS
  90.    WWWWrrrriiiittttiiiinnnngggg AAAA SSSSTTTTIIIIFFFFFFFF FFFFiiiilllleeee
  91.      The typical sequence of operations for writing a STIFF file is as
  92.      follows:
  93.  
  94.      1.   Obtain a writable file descriptor. Note that this descriptor can be
  95.           associated with a non-seekable stream.
  96.  
  97.      2.   Call _S_T_O_p_e_n with the writable file descriptor and the flag SSSSTTTT____WWWWRRRRIIIITTTTEEEE.
  98.  
  99.      3.   Fill in the STIFF image header (_S_T_I_m_a_g_e_H_e_a_d_e_r or _P_S_T_I_m_a_g_e_H_e_a_d_e_r).
  100.  
  101.      4.   Optionally, add any application specific TIFF tags to the file using
  102.           _S_T_A_d_d_T_a_g.
  103.  
  104.      5.   Call the image header write function _S_T_W_r_i_t_e_I_m_a_g_e_H_e_a_d_e_r.
  105.  
  106.      6.   Write the image data using _S_T_W_r_i_t_e.
  107.  
  108.      7.   Repeat steps 3 through 6 for each page of image data.
  109.  
  110.      8.   Close the STIFF stream using _S_T_C_l_o_s_e.
  111.  
  112.      9.   Close the file descriptor.
  113.  
  114.    RRRReeeeaaaaddddiiiinnnngggg AAAA SSSSTTTTIIIIFFFFFFFF FFFFiiiilllleeee
  115.      The typical sequence of operations for reading a STIFF file is as
  116.      follows:
  117.  
  118.      1.   Obtain a readable file descriptor. Note that this descriptor can be
  119.           associated with a non-seekable stream.
  120.  
  121.      2.   Call _S_T_O_p_e_n with the readable file descriptor and the flag SSSSTTTT____RRRREEEEAAAADDDD.
  122.  
  123.      3.   Call the image header read function _S_T_R_e_a_d_I_m_a_g_e_H_e_a_d_e_r or
  124.           _P_S_T_R_e_a_d_I_m_a_g_e_H_e_a_d_e_r.
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. LLLLIIIIBBBBSSSSTTTTIIIIFFFFFFFF((((3333))))                      IIIImmmmpppprrrreeeessssssssaaaarrrriiiioooo                       LLLLIIIIBBBBSSSSTTTTIIIIFFFFFFFF((((3333))))
  137.  
  138.  
  139.  
  140.      4.   Access the fields of the image header structure to determine the
  141.           amount of image data to be read for this page.
  142.  
  143.      5.   Optionally, obtain the values for any application specific TIFF tags
  144.           from the file using _S_T_G_e_t_T_a_g.
  145.  
  146.      6.   Read the image data using _S_T_R_e_a_d.
  147.  
  148.      7.   Repeat steps 3 through 6 for each page of image data.  The last page
  149.           of image data will either have its _l_a_s_t image header field set to
  150.           one or will be an empty page (i.e. amount of data equals zero).
  151.  
  152.      8.   Close the STIFF stream using _S_T_C_l_o_s_e.
  153.  
  154.      9.   Close the file descriptor.
  155.  
  156.      If an error condition is returned by a _l_i_b_s_t_i_f_f function, _S_T_P_e_r_r_o_r can be
  157.      used to print a diagnostic error message to the standard error.
  158.  
  159. GGGGEEEENNNNEEEERRRRIIIICCCC SSSSTTTTIIIIFFFFFFFF FFFFIIIILLLLEEEE SSSSTTTTRRRRUUUUCCCCTTTTUUUURRRREEEE
  160.      While it is not necessary to understand the STIFF file structure to use
  161.      _l_i_b_s_t_i_f_f, this explanation is provided for those who need to know.  A
  162.      Stream TIFF file is first and foremost a valid TIFF file. STIFF is
  163.      derived from the TIFF 6.0 Specification available from Aldus Corporation
  164.      (see below). The terms used below to describe a STIFF file (e.g. IFD) are
  165.      explained in the TIFF specification and will not be described here.
  166.  
  167.      The primary restriction STIFF places on the TIFF structure is that all
  168.      data must be read from or written to the file without the need to seek
  169.      within the file.  Specifically, within a STIFF file:
  170.  
  171.      1.   The bitmap image data must be in page number order.
  172.  
  173.      2.   Data which does not fit in the value section of a tag must be
  174.           located immediately after the IFD and must occur in the same order
  175.           in which the tags are encountered. The exception to this is the
  176.           image data itself, which must come last for each page.
  177.  
  178.      3.   Image data must immediately follow the IFD and any offset values
  179.           associated with it.
  180.  
  181.      4.   A terminating, empty IFD will always be added to the end of the
  182.           STIFF file.  This IFD guarantees that an IFD with 0000 in its 'next
  183.           IFD' field will appear in the IFD chain. Note that this empty IFD
  184.           will not be encountered when following IFD pointers if the last
  185.           'real' IFD is written with the 'last' parameter set to 1. While the
  186.           TIFF specification states that IFDs should not be empty, relaxing
  187.           this restriction appears to have no impact on TIFF compatibility.
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. LLLLIIIIBBBBSSSSTTTTIIIIFFFFFFFF((((3333))))                      IIIImmmmpppprrrreeeessssssssaaaarrrriiiioooo                       LLLLIIIIBBBBSSSSTTTTIIIIFFFFFFFF((((3333))))
  203.  
  204.  
  205.  
  206.           A STIFF file can be represented diagrammatically as:
  207.  
  208.                           _______________________________
  209.  
  210.                            TIFF header (8 bytes)
  211.  
  212.                           _______________________________
  213.  
  214.                            Optional intervening space
  215.  
  216.                           _______________________________
  217.  
  218.                            IFD for page 1
  219.  
  220.                           _______________________________
  221.  
  222.                            Data for long values in IFD 1
  223.  
  224.                           _______________________________
  225.  
  226.                            Image data for page 1
  227.  
  228.                           _______________________________
  229.  
  230.                            Optional intervening space
  231.  
  232.                           _______________________________
  233.  
  234.                            IFD for page 2
  235.  
  236.                           _______________________________
  237.  
  238.                            Data for long values in IFD 2
  239.  
  240.                           _______________________________
  241.  
  242.                            Image data for page 2
  243.  
  244.                           _______________________________
  245.  
  246.                            ...
  247.  
  248.                           _______________________________
  249.  
  250.                            Terminating empty IFD
  251.  
  252.                           _______________________________
  253.                           ||||||||||||||||||||||||||||||||||||||||||||
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.                                                          ||||||||||||||||||||||||||||||||||||||||||||
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341.      The _l_i_b_s_t_i_f_f functions support only the Motorola (MM) byte ordering. In
  342.      addition to supporting TIFF class B, G and R data, _l_i_b_s_t_i_f_f supports the
  343.      CMYK color image data type (PhotoMetricInterpretation = 5 and InkSet = 1)
  344.      and four additional color image separation types: CMY, YMC, YMCK, and
  345.  
  346.  
  347.  
  348.                                                                         PPPPaaaaggggeeee 4444
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355. LLLLIIIIBBBBSSSSTTTTIIIIFFFFFFFF((((3333))))                      IIIImmmmpppprrrreeeessssssssaaaarrrriiiioooo                       LLLLIIIIBBBBSSSSTTTTIIIIFFFFFFFF((((3333))))
  356.  
  357.  
  358.  
  359.      KCMY.  For these additional types, PhotoMetricInterpretation = 5, InkSet
  360.      = 2, NumberOfInks = 3 or 4, and the InkNames tag is used to indicate the
  361.      inks contained in each channel.
  362.  
  363.      When reading an image header, _l_i_b_s_t_i_f_f parses the ink names for these
  364.      additional types, and sets the _t_y_p_e field of the SSSSTTTTIIIImmmmaaaaggggeeeeHHHHeeeeaaaaddddeeeerrrr structure
  365.      to the appropriate value defined in <_s_t_i_f_f._h>.  When writing an image
  366.      header, _l_i_b_s_t_i_f_f writes the appropriate PhotoMetricInterpretation,
  367.      InkSet, NumberOfInks, and InkNames tags based on the value of the _t_y_p_e
  368.      field of the SSSSTTTTIIIImmmmaaaaggggeeeeHHHHeeeeaaaaddddeeeerrrr structure.
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.                                                                         PPPPaaaaggggeeee 5555
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421. LLLLIIIIBBBBSSSSTTTTIIIIFFFFFFFF((((3333))))                      IIIImmmmpppprrrreeeessssssssaaaarrrriiiioooo                       LLLLIIIIBBBBSSSSTTTTIIIIFFFFFFFF((((3333))))
  422.  
  423.  
  424.  
  425.      The CMYK data class is a TIFF data format extension.
  426.  
  427.              TTTTaaaagggg                         PPPPoooossssssssiiiibbbblllleeee VVVVaaaalllluuuueeeessss
  428.              _________________________________________________________
  429.              BitsPerSample               (1,1,1,1) (4,4,4,4) (8,8,8,8)
  430.              PhotoMetricInterpretation   5
  431.              SamplesPerPixel             4
  432.              PlanarConfiguration         1,2
  433.              NumberOfInks                4
  434.  
  435.      The CMY data class is a subset of the CMYK class and differs from the
  436.      CMYK class in a TIFF compliant manner.  In the description of the
  437.      SamplesPerPixel tag below, "1 bit planar" refers to the case where
  438.      BitsPerSample has the value (1,1,1,1) and PlanarConfiguration has the
  439.      value 2.
  440.  
  441.            TTTTaaaagggg                         PPPPoooossssssssiiiibbbblllleeee VVVVaaaalllluuuueeeessss
  442.            _____________________________________________________________
  443.            BitsPerSample               (1,1,1,1) (1,1,1) (4,4,4) (8,8,8)
  444.            PhotoMetricInterpretation   5
  445.            SamplesPerPixel             3 (4 for 1 bit planar)
  446.            PlanarConfiguration         1,2
  447.            NumberOfInks                3
  448.  
  449.      The YMC data class is a class similar to the CMY class with the exception
  450.      that data is organized as YMC instead of CMY.  When using _l_i_b_s_t_i_f_f, YMC
  451.      data corresponds to the data type SSSSTTTT____TTTTYYYYPPPPEEEE____YYYYMMMMCCCC.
  452.  
  453.            TTTTaaaagggg                         PPPPoooossssssssiiiibbbblllleeee VVVVaaaalllluuuueeeessss
  454.            _____________________________________________________________
  455.            BitsPerSample               (1,1,1,1) (1,1,1) (4,4,4) (8,8,8)
  456.            PhotoMetricInterpretation   5
  457.            SamplesPerPixel             3 (4 for 1 bit planar)
  458.            PlanarConfiguration         1,2
  459.            NumberOfInks                3
  460.            InkSet                      2
  461.            InkNames                    yellow,magenta,cyan
  462.  
  463.      The YMCK class is a class similar to the CMYK class with the exception
  464.      that data is organized as YMCK instead of CMYK.  When using _l_i_b_s_t_i_f_f,
  465.      YMCK data corresponds to the data type SSSSTTTT____TTTTYYYYPPPPEEEE____YYYYMMMMCCCCKKKK.
  466.  
  467.              TTTTaaaagggg                         PPPPoooossssssssiiiibbbblllleeee VVVVaaaalllluuuueeeessss
  468.              _________________________________________________________
  469.              BitsPerSample               (1,1,1,1) (4,4,4,4) (8,8,8,8)
  470.              PhotoMetricInterpretation   5
  471.              SamplesPerPixel             4
  472.              PlanarConfiguration         1,2
  473.              NumberOfInks                4
  474.              InkSet                      2
  475.  
  476.  
  477.  
  478.  
  479.  
  480.                                                                         PPPPaaaaggggeeee 6666
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487. LLLLIIIIBBBBSSSSTTTTIIIIFFFFFFFF((((3333))))                      IIIImmmmpppprrrreeeessssssssaaaarrrriiiioooo                       LLLLIIIIBBBBSSSSTTTTIIIIFFFFFFFF((((3333))))
  488.  
  489.  
  490.  
  491.              InkNames                    yellow,magenta,cyan,black
  492.  
  493.      The KCMY class is a class similar to the CMYK class with the exception
  494.      that the data is organized as KCMY instead of CMYK.  When using _l_i_b_s_t_i_f_f,
  495.      KCMY data corresponds to the data type SSSSTTTT____TTTTYYYYPPPPEEEE____KKKKCCCCMMMMYYYY.
  496.  
  497.              TTTTaaaagggg                         PPPPoooossssssssiiiibbbblllleeee VVVVaaaalllluuuueeeessss
  498.              _________________________________________________________
  499.              BitsPerSample               (1,1,1,1) (4,4,4,4) (8,8,8,8)
  500.              PhotoMetricInterpretation   5
  501.              SamplesPerPixel             4
  502.              PlanarConfiguration         1,2
  503.              NumberOfInks                4
  504.              InkSet                      2
  505.              InkNames                    black,cyan,magenta,yellow
  506.  
  507.      Note that for the RGB, CMY, and YMC classes with BitsPerSample values of
  508.      (1,1,1) and a PlanarConfiguration value of 1, pixels are stored two to a
  509.      byte, with the bits ordered from most to least significant. For example,
  510.      CMY data is stored as: CMY0CMY0. Rows are padded to contain an integral
  511.      number of bytes.
  512.  
  513.      Refer to the header file _s_t_i_f_f._h for additional information regarding the
  514.      STIFF file structure.
  515.  
  516. PPPPRRRRIIIINNNNTTTTIIIINNNNGGGG SSSSPPPPEEEECCCCIIIIFFFFIIIICCCC SSSSTTTTIIIIFFFFFFFF
  517.      The printing specific functions (PST) provided by _l_i_b_s_t_i_f_f to read and
  518.      write STIFF files as described above. The printing specific aspect of
  519.      these functions is found in the image header structure. The printing
  520.      specific image header (PSTImageHeader) contains all fields of the
  521.      (STImageHeader) plus printing specific information fields such as image
  522.      resolution and halftoning method. If a STIFF stream is written using the
  523.      generic functions and is read using the printing specific functions,
  524.      default values will be used for the PSTImageHeader fields not found in
  525.      the STIFF stream. Similarly, a STIFF stream written using the printing
  526.      specific functions can be read by the generic functions. In this case,
  527.      the additional information in the stream can be ignored or obtained using
  528.      the _S_T_G_e_t_T_a_g function.
  529.  
  530.      Refer to the header file _p_r_i_n_t_s_t_i_f_f._h for additional information
  531.      regarding printing specific STIFF.
  532.  
  533. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  534.      _v_s_t_i_f_f(1), _z_o_o_m_s_t_i_f_f(1).
  535.  
  536.      _T_I_F_F _6._0 _S_p_e_c_i_f_i_c_a_t_i_o_n - Aldus Corporation, 1992.  For a copy of the TIFF
  537.      6.0 specification contact Aldus Developers Desk, Aldus Corporation, 411
  538.      First Avenue South, Seattle, WA 98104-2871, (206) 628-6593.
  539.  
  540.  
  541.  
  542.  
  543.  
  544.  
  545.  
  546.                                                                         PPPPaaaaggggeeee 7777
  547.  
  548.  
  549.  
  550.